package com.tiantian.service.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.tiantian.service.AuditService;
import com.tiantian.service.BusinessrechargedetailsService;
import com.tiantian.service.BuyerRaiseCashDetailsService;
import com.tiantian.service.IndexService;
import com.tiantian.service.UserComplaintsService;

@Service
public class IndexServiceImpl implements IndexService {
	@Autowired
	private AuditService auditService;
	@Autowired
	private UserComplaintsService userComplaintsService;
	@Autowired
	private BusinessrechargedetailsService rechargeService;
	@Autowired
	private BuyerRaiseCashDetailsService raiseCaseService;

	public static class Count {
		private Long auditCount;// 审核申请
		private Long complaintsCount;// 申诉介入请求数
		private Long rechargeCount;// 商家资金申请数
		private Long raiseCashCount;// 买手提现申请数

		public Long getAuditCount() {
			return auditCount;
		}

		public void setAuditCount(Long auditCount) {
			this.auditCount = auditCount;
		}

		public Long getComplaintsCount() {
			return complaintsCount;
		}

		public void setComplaintsCount(Long complaintsCount) {
			this.complaintsCount = complaintsCount;
		}

		public Long getRechargeCount() {
			return rechargeCount;
		}

		public void setRechargeCount(Long rechargeCount) {
			this.rechargeCount = rechargeCount;
		}

		public Long getRaiseCashCount() {
			return raiseCashCount;
		}

		public void setRaiseCashCount(Long raiseCashCount) {
			this.raiseCashCount = raiseCashCount;
		}

	}

	@Override
	public Count getCount() {
		Count count = new Count();

		Map<String, String> params1 = new HashMap<String, String>();
		params1.put("auditStatus", "1");
		count.setAuditCount(auditService.count(params1));

		Map<String, String> params2 = new HashMap<String, String>();
		params2.put("appealsStatus", "0");
		count.setComplaintsCount(userComplaintsService.count(params2));

		Map<String, String> params3 = new HashMap<String, String>();
		params3.put("statusInfor", "1");
		count.setRechargeCount(rechargeService.count(params3));

		Map<String, String> params4 = new HashMap<String, String>();
		params4.put("statusInfor", "1");
		count.setRaiseCashCount(raiseCaseService.count(params4));
		return count;
	}
}
